package org.example.mine.mapper;

import cn.hutool.core.date.DateTime;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.example.model.domain.mine.ExpressWithdraw;

import java.math.BigDecimal;
import java.util.List;
@Mapper
public interface WithdrawMapper {

    void addwithdrawrecord(ExpressWithdraw expressWithdraw);

    @Select("select * from express_withdraw where register_ip=#{id} order by over_time asc")
    List<ExpressWithdraw> getwithdrawrecord(Long id);

    @Select("select * from express_withdraw where id=#{id}")
    ExpressWithdraw getwithdrawdetailbyid(Integer id);

    @Select("select if(sum(money) is NULL,0,sum(money)) from express_withdraw where status=2 and register_ip=#{registerIp} and over_time BETWEEN #{begin} and #{end}")
    BigDecimal getDailyIncome(Long registerIp, DateTime begin, DateTime end);
}
